loadPNG

Loads a PNG file using specific color type

@trusted
managed!(PNGFileFormat!Color)
loadPNG
(
Color
ImageImpl = ImageStorageHorizontal!Color
IR
)
(,
IAllocator allocator = theAllocator()
)
if (
isInputRange!IR &&
is(ElementType!IR == ubyte)
&&
isImage!ImageImpl
)

Parameters

input IR

Input range that returns the files bytes

allocator IAllocator

The allocator to use the allocate the image

Return Value

Type: managed!(PNGFileFormat!Color)

A PNG file, loaded as an image along with its headers. Using specified image storage type.

Examples

    import std.experimental.color;
    import std.conv : hexString;
    
    import std.file : read;
	auto input = cast(ubyte[])"89504E470D0A1A0A0000000D4948445200000002000000020802000000FDD49A73000000097048597300000B1300000B1301009A9C180000000774494D4507DF07150E122E54E72FF10000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000114944415408D763F8CFC0C0F09F014A000019F402FEE23BE1150000000049454E44AE426082".hexString;
    
    managed!(PNGFileFormat!RGB8) image = loadPNG!RGB8(input);

Meta